package com.mingyuan.library.domain.lending.patron.event;

import com.mingyuan.library.domain.lending.patron.model.valueobject.PatronInformation;
import lombok.NonNull;
import lombok.Value;

import java.time.Instant;
import java.util.UUID;

@Value
public class MaximumNumberOhHoldsReached implements PatronEvent {
    @NonNull
    UUID eventId = UUID.randomUUID();
    @NonNull
    Instant when;
    @NonNull
    UUID patronId;
    int numberOfHolds;

    public static MaximumNumberOhHoldsReached now(PatronInformation patronInformation, int numberOfHolds) {
        return new MaximumNumberOhHoldsReached(
                Instant.now(),
                patronInformation.getPatronId().getPatronId(),
                numberOfHolds);
    }
}